<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <script>
      const names = ["abc", "cba", "mba", "nba"]
      /*
        回调函数有三个参数
          参数一: 执行时的对应元素
          参数二: 对应的索引值
          参数三: 完整的数组对象
       */
      const newNames = names.map((item, index, arr) => {
        return item + "000"
      })
      console.log(newNames)

      // const newNames1 = names.forEach(item => {
      //  return item + '111'
      // })
      // console.log(newNames1)

      // 过滤大于50的元素
      const num = [110, 123, 50, 32, 55, 10, 8, 333]
      const newNum = num.filter(item => {
        return item > 50
      })
      console.log("newNum", newNum)
      // 偶数
      const newNum2 = num.filter(item => {
        return item % 2 ===0
      })
      console.log("newNum2", newNum2)
      
      
    </script>
  </body>
</html>
